﻿#define _CRT_SECURE_NO_WARNINGS 1

//编程初学者入门训练第104题
//BC106 上三角矩阵判定
//https://www.nowcoder.com/practice/f5a29bacfc514e5a935723857e1245e4?tpId=107&tqId=33387&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D3%26tpId%3D107%26type%3D107&difficulty=undefined&judgeStatus=undefined&tags=&title=

#include <stdio.h>

int main() {
    int n = 0;
    scanf("%d", &n);
    int arr[10][10] = { 0 };

    //输入
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scanf("%d", &arr[i][j]);
        }
    }

    //判断
    //三角矩阵，通过下标发现i>0 && j<i区域不能有大于0的数字
    int flag = 0;//有为1，没有为0
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            if (arr[i][j] != 0)
                flag = 1;
        }
    }

    if (flag) {
        printf("NO\n");
    }
    else {
        printf("YES\n");
    }

    return 0;
}